#include <iostream>

#include "BillManager.h"

 

int main() {
    BillManager billManager;
    int choice;
    double amount, budgetLimit;
    std::string date, category, remark;
 
    while (true) {
        std::cout << "\nPersonal Bill Manager Menu:\n";
        std::cout << "1. Record Income\n";
        std::cout << "2. Record Expense\n";
        std::cout << "3. Display Bills\n";
        std::cout << "4. Query Bills\n";
        std::cout << "5. Set Monthly Budget\n";
        std::cout << "6. Display Current Budget Balance\n";
        std::cout << "7. Reset Monthly Budget\n";
        std::cout << "8. Monthly Statistics\n";
        std::cout << "9. Exit\n";
        std::cout << "Enter your choice: ";
        std::cin >> choice;
 
        switch (choice) {
            case 1:
                std::cout << "Enter date (YYYY-MM-DD): ";
                std::cin >> date;
                std::cout << "Enter amount: ";
                std::cin >> amount;
                while (amount <= 0) {
                    std::cout << "Amount must be positive. Enter again: ";
                    std::cin >> amount;
                }
                std::cout << "Enter category: ";
                std::cin >> category;
                std::cout << "Enter remark (optional): ";
                std::getline(std::cin, remark);
                billManager.addIncome(Income(date, amount, category, remark));
                break;
            case 2:
                std::cout << "Enter date (YYYY-MM-DD): ";
                std::cin >> date;
                std::cout << "Enter amount: ";
                std::cin >> amount;
                while (amount <= 0) {
                    std::cout << "Amount must be positive. Enter again: ";
                    std::cin >> amount;
                }
                std::cout << "Enter category: ";
                std::cin >> category;
                std::cout << "Enter remark (optional): ";
                std::getline(std::cin, remark);
                billManager.addExpense(Expense(date, amount, category, remark));
                break;
            case 3:
                billManager.displayBills();
                break;
            case 4:
                std::cout << "Enter date or date range (YYYY-MM-DD or YYYY-MM-DD to YYYY-MM-DD) or category: ";
                std::getline(std::cin, date);
                std::string incomeCategory, expenseCategory;
                std::istringstream iss(date);
                if (std::getline(iss, incomeCategory, ' ') && iss.peek() == 't' && std::getline(iss, expenseCategory, 'o')) {
                    // Handle date range or category query for income and expense separately
                    std::string dummy;
                    std::getline(iss, dummy); // Consume "to"
                    std::getline
